/// @file parser.hh
/// @brief Parse input tree files loading DAG structure

// *************************************************************************

// Copyright© 2010 Texas A&M University, 
//                 College Station, Texas
//                 Contact: R Crosby <rwc@cs.tamu.edu>
//
// Copyright© 2003, 2004 by BiRC -- Bioinformatics Research Center
//                 University of Aarhus, Denmark
//                 Contact: Thomas Mailund <mailund@birc.dk>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// *************************************************************************

#ifndef PARSER_HH
#define PARSER_HH

class DAG;
class SMap;

namespace Parser {

    // exceptions

    class FileOpenError {

	const char *_fname;

    public:

	FileOpenError(const char *fname) : _fname(fname) {}
	const char * fname() const { return _fname; }

    };

    class ParseError {

	const char *_fname;
	int         _line_no;

    public:

	ParseError(const char *fname, int line_no)
	    : _fname(fname), _line_no(line_no) {}
	const char * fname() const { return _fname; }
	int line_no() const { return _line_no; }

    };

    class DegreeError {
    };

    // Do the parse!

    void parse_tree( const char * fname, 
                     DAG &        dag,
		     SMap &       smap );

};

#endif // PARSER_HH
